package cn.ssj.controller;

import cn.ssj.entity.Dynamic;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/9/5 0005.
 */
@RestController
@EnableAutoConfiguration
public class DynamicController extends BaseController<Dynamic,Integer> {

    @RequestMapping("/back/addDynamic")
    public String add(Dynamic entity) {
        return super.add(entity);
    }

    @RequestMapping("/back/updateDynamic")
    public String update(Dynamic entity) {
        return super.update(entity);
    }

    @RequestMapping("/back/deleteDynamic")
    public String delete(@RequestParam("ids[]") Integer[] ids) {
        return super.delete(ids);
    }

    @RequestMapping("/back/queryAllDynamicByPage")
    public String queryAllByPage(Integer pageNumber) {
        return super.queryAllByPage(pageNumber);
    }

    @RequestMapping("/back/dynamicUpload")
    public String upload(MultipartFile file, HttpServletRequest request) {
        super.setLocationPath(getLocationPath()+ "dynamic");
        super.setHandlerPath(getHandlerPath()+"dynamic");
        return super.upload(file, request);
    }
}
